#ifndef GUI_H
#define GUI_H



#include "widget_begin.h"
#include "widget_buy.h"
#include "widget_play.h"
#include "init.h"

#include <queue>
#include <map>
#include <string>
#include <QtGui>
#include <QSound>
//#include <QObject>



class begin_widget;

class buy_widget;

class play_widget;


class pre_move_info;
class pre_fire_info;



class g_graphics
{

public:

	g_graphics();
	~g_graphics();

	std::string get_color( unsigned int x );

	void set_new_units_resources( string name, std::vector< std::pair< string, string > >& icons, string sound_f ); 

	QPixmap* p;

	QPen* fire;

	QBrush* map_background;

	std::map< std::string, std::map< std::string, std::pair< QPixmap*, QPixmap* > > > units_pixmaps;
	std::map< unsigned int, QPixmap* > terrain_pixmaps;
	std::map< std::string, QPixmap* > bonus_pixmaps;
	std::map< std::string, std::map< std::string, QSound* > > units_sounds;
	std::map< std::string, QPixmap* > begin_pixmaps;


private:

	std::string* col;

};



class MyQScrollArea: public QScrollArea
{

public:

	MyQScrollArea( QWidget* parent = 0 ): QScrollArea( parent ) {};

	void setSizeHint( QSize s );
    virtual QSize sizeHint() const;


private:

	QSize size;

};



class gui: public QMainWindow
{

public:

	gui( QWidget *parent = 0, Qt::WFlags flags = 0 );
	~gui();

	begin_widget* begin_w;
	buy_widget* buy_w;
	play_widget* play_w;
	
};



class game_gui
{

public:

	static game_gui* get_instance();
	void get_graphics();
	void create_gui();

	void show_game_end( player* won_p );

	void show_move( unit* u, unsigned int x, unsigned int y, pre_move_info* pmi );
	void show_fire( unit* u, unsigned int x, unsigned int y, pre_fire_info* pfi );
	void show_next_turn();
	void set_paused( bool paused );
	

	gui* g;
	g_graphics* graphics;


	int x;


private:

	game_gui( int _x ): x( _x )
	{
		g = 0;
		graphics = 0;
	};
	game_gui( const game_gui& );
	game_gui& operator=( const game_gui& x );

};



class pre_move_info
{

public:

	pre_move_info( unit* u, unsigned int x, unsigned int y );
	
	unsigned int ox;
	unsigned int oy;
	std::queue< std::pair< unsigned int, unsigned int > >* path;

};



class pre_fire_info
{

public:

	pre_fire_info( unit* u, unsigned int x, unsigned int y );

	bool s;

};



#endif
